//
//  FMCategoryCollectionViewCell.m
//  PsychologyFM
//
//  Created by lanou on 16/1/12.
//  Copyright © 2016年 ZhangLuDu. All rights reserved.
//

#import "FMCategoryCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@implementation FMCategoryCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 5, kScreenWidth / 4 - 30, kScreenWidth / 4 - 30)];
        //_iconImageView.backgroundColor = FMRed;
        [self.contentView addSubview:_iconImageView];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, _iconImageView.bottom + 5, kScreenWidth / 4, 15)];
        //_titleLabel.backgroundColor = FMBlue;
        _titleLabel.textColor = FMGray;
        _titleLabel.font = [UIFont systemFontOfSize:14];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_titleLabel];
    }
    return self;
}

- (void)setModel:(FMCategoryModel *)model
{
    _model = model;
    [_iconImageView sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:nil options:(SDWebImageRetryFailed) completed:nil];
    _titleLabel.text = model.name;
}

@end
